package com.googlecode.imanager.client.util;


/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public enum ControlState {
    HIPERLINK,
    SELECTED,
    CHECKED,
    PRESSED,
    FOCUSED,
    HOVER;
    
    private static final ControlState[] VALUES = values();
    
    private final int flag = 1 << ordinal();
    
    ControlState() {
    }
    
    public int getStateFlag(){
        return flag;
    }

    public static int count(){
        return VALUES.length;
    }
    
    public static ControlState get(int index){
        return VALUES[index];
    }

    public static int flagsOf(ControlState[] states){
        int flags = 0;
        for (ControlState s : states){
            flags |= s.getStateFlag();
        }
        return flags;
    }
    
}
